<template>
	<!-- 商品信息 -->
	<view class="bg-white u-m-t-26" style="border-radius: 24rpx;">
		<view class="u-font-xl u-border-bottom u-p-b-24 u-p-t-24 u-p-l-24 fw-middel">{{detailObj.businessName}}
		</view>

		<view class="u-m-t-35 u-m-b-35 u-p-l-24 u-p-r-24">

			<view @click="item.select = !item.select" class="u-flex u-col-top u-p-b-18"
				v-for="(item,index) in detailObj?.goodsList" :key="index">
				<block v-if="showRefund">
					<u-icon v-if="item.select" name="checkmark-circle-fill" size="50" color="#ffc300"
						style="align-self: center;" class="u-m-r-25"></u-icon>
					<view v-else class="seleCt"></view>
				</block>

				<u-image :src="item.images" width="120" height="120"></u-image>
				<view class="u-flex-1 u-m-l-24">
					<view class="u-font-md">{{item.name}}</view>
					<view class="u-font-sm color-gary-xs u-m-t-10 u-m-b-5" v-if="item.strSpecVal">
						{{item.strSpecVal}}
					</view>
					<view class="u-font-sm "><text class="u-font-xs">x</text>{{item.nums}}</view>
				</view>
				<text>￥{{item.price}}</text>
			</view>

			<u-line class="u-line"></u-line>


			<view class="u-m-t-25">
				<view class="u-flex u-row-between u-font-md u-p-b-18">
					<text class="">订单号<text>{{detailObj.orderNo}}</text></text>

					<u-button type="success" size="mini" @click="copy(detailObj.orderNo)">复制</u-button>
				</view>
				<view class="u-flex u-row-between u-font-md u-p-b-25">
					<text class="">包装费</text>
					<text>￥{{detailObj.packageAmount}}</text>
				</view>
				<view class="u-flex u-row-between u-font-md u-p-b-25">
					<text class="">配送费</text>
					<text>￥{{detailObj.deliveryAmount}}</text>
				</view>



				<view class="u-flex-1  u-p-b-25" style="text-align: right;font-weight: 600;">
					<text>合计:{{detailObj.realAmount}}</text>
				</view>
			</view>

			<view class="u-flex u-row-center" v-if="showRefund">
				<u-button size="mini" type="warning" @click="confirmRefund">确认退货退款</u-button>
			</view>





		</view>
	</view>

	<view class="bg-white u-m-t-26 u-m-t-35 u-m-b-35 u-p-l-24 u-p-r-24 u-p-t-24" style="border-radius: 24rpx;">
		<view style="font-weight: 700;font-size: 38upx;">分账明细</view>
		<view class="u-m-t-40 u-font-sm">
			<view class="u-flex u-row-between  u-p-b-30">
				<text class="">用户名</text>
				<text>{{detailObj.userName}}</text>
			</view>

			<block v-if="detailObj.userSplitAmount==0">
				<view class="u-flex u-row-between  u-p-b-30">
					<text class="">用户收益</text>
					<text>￥{{detailObj.userGain}}</text>
				</view>
				<view class="u-flex u-row-between  u-p-b-30">
					<text class="">上级公司名称</text>
					<text>{{detailObj.companyBusinessName}}</text>
				</view>
				<view class="u-flex u-row-between  u-p-b-30">
					<text class="">上级公司分账金额</text>
					<text>￥{{detailObj.companySplitAmount}}</text>
				</view>
			</block>
			<block v-else-if="detailObj.userSplitAmount>0">
				<view class="u-flex u-row-between  u-p-b-30">
					<text class="">用户分账金额</text>
					<text>￥{{detailObj.userSplitAmount}}</text>
				</view>
			</block>

			<view class="u-flex u-row-between  u-p-b-30">
				<text class="">分账状态</text>
				<text style="font-weight: 600;">
					<text  style="color:blue;" v-if="detailObj.splitState ==1">
						<block >待分账</block>
					</text>
					<text  style="color: green;" v-else-if="detailObj.splitState ==5">
					<block >已分账</block>
					</text>

					<text  style="color:red ;" v-else-if="detailObj.splitState ==10">
						<block>分账失败</block>
					</text>
				</text>
			</view>
			<view class="u-flex u-row-between u-font-md u-p-b-30">
				<text class="">分账日期</text>
				<text>{{detailObj.splitDate}}</text>
			</view>
		</view>
	</view>

</template>

<script setup lang="">
	import { onLoad } from '@dcloudio/uni-app'

	import shopApi from '@/api/shop'
import { ref } from "vue";
    onLoad((e)=>{
	   shopApi.getCashOutDetail(e).then(res=>{
		   console.log(res)
		   detailObj.value = res.data
	   })
	})

	const detailObj = ref({})

	function copy(str){
		uni.setClipboardData({
		  data:str,
		  success: function() {
		    console.log('复制成功');
		  }
		})

	}

</script>

<style>
</style>
